< previous page page_335 next page >

Page 335
Printing and exporting the report is done by using one of two methods. The first method is done within the code and allows the user to print or export the report without previewing itby using either the Data Reports PrintReport or ExportReport method. Using the PrintReport method is very simple; you simply add a single line of code that prints the report:
drCustOrders.PrintReport
However, the ExportReport method requires several parameters in order for it to know how to export the report and where to place it. The following is the syntax for the command:
object.ExportReport(index, filename, Overwrite, ShowDialog, Range, PageFrom, PageTo)
Each of these parameters enables you to customize the export process. Table 12.4 lists each parameter and its description.
TABLE 12.4. THE PARAMETERS FOR THEExportReportMETHOD.
ParameterDescription
objectThis references the Data Report you want to export.
indexThis specifies the export format to use.
filenameThis specifies the name of the file to export the report to.
overwriteIf True, the file will be overwritten.
showDialogThis specifies whether the Save As dialog should be displayed.
rangeThis sets an integer that determines whether all the pages in the report will be exported.
PageFromThis is the starting page of the export.
PageToThis is the ending page of the export.

An example of this command would be the following:
drCustOrders.ExportReport rptKeyHTML, C:\temp\custord, True, False
The second way the user can print or export a report is by using the available buttons at the top of the Report Preview Form (see Figure 12.20). These provide the same functionality as the methods, only the user must first preview the report.

 
< previous page page_335 next page >

If you like this book, buy it!